<?php
//We need this for connectDB and getIDByEmail
require("dbFunctions.php");

/**
 * If a Supplier is being removed, we don't want to remove it from the database
 * and break connections that exist in the ResourceDesignation table. Instead of
 * removing them, set the isActive field to false.
 * 
 * Author: Steve Gennaoui
 * Date: 11/07/2012
 */

//Get the parameters
$email = $_REQUEST['email'];
$email = strtolower($email);
//Get the ID of the requestor
$supplier_id = getIDbyEmail($email,"Suppliers");

if( $supplier_id < 0 )
	die("The email $email was not a valid Supplier email.");

$dbh = connectDB();

$query = "UPDATE Suppliers SET is_active=false WHERE sup_id=:sup_id";
$stmt = $dbh->prepare($query);
$stmt->bindParam(':sup_id',$supplier_id);
$stmt->execute();

$stmt=null;
$dbh=null;

?>
